#include<iostream>
#include<algorithm>
using namespace std;
struct h{
	int begin;
	int end;
	int bh;
	bool kn=true;
};
bool comp(h x,h y){
	return x.end<y.end;
}
int main(){
	int n;
	cin>>n;
	h a[n];
	for(int i=0;i<n;i++){
		cin>>a[i].begin>>a[i].end;
		a[i].bh=i;
	}
	sort(a,a+n,comp);
	int cjhd[n]={0};
	int ji=0;
	for(int i=0;i<n;i++){
		if(a[i].kn==true){
			cjhd[ji]=a[i].bh;
			ji++;
			a[i].kn=false;
			for(int j=i+1;j<n;j++){
				if(a[j].begin<a[i].end){
					a[j].kn=false;
				}
			}
		}
	}
	for(int i=0;i<ji-1;i++){
		cout<<cjhd[i]+1<<" ";
	}
	cout<<cjhd[ji-1]+1;
}
